<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>开关3</title>

  <style>
    /* From www.lingdaima.com */
    /* The switch - the box around the slider */
    .switch {
      position: relative;
      display: inline-block;
      width: 62px;
      height: 35px;
      font-size: 17px;
    }

    /* Hide default HTML checkbox */
    .switch input {
      display: none;
      /* opacity: 1;
      width: 0;
      height: 0; */
    }

    /* The slider */
    .slider {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0px;
      background: #fff;
      transition: .4s;
      border-radius: 30px;
      border: 1px solid #ccc;
      cursor: pointer;
    }

    .slider:before {
      position: absolute;
      left: 1px;
      bottom: 2px;
      content: "";
      width: 30px;
      height: 30px;
      border-radius: 50%;
      background-color: #fff;
      box-shadow: 0 2px 5px #999999;
      transition: .4s;
    }

    input:checked+.slider {
      background-color: #5fdd54;
      border: 1px solid transparent;
    }

    input:checked+.slider:before {
      transform: translateX(100%);
    }
  </style>
</head>

<body>
  <label class="switch">
    <input type="checkbox" checked>
    <span class="slider"></span>
  </label>
</body>

</html>